package siac.com.controller;

import javax.faces.context.FacesContext;
public class PageViewIdGenerator {
	private String includedPage = "/login.xhtml";

	public String sideBarAction(){
 /**
  * Get the request parameter map from the context, so that we can find which link of the side is clicked
  */
		FacesContext context = FacesContext.getCurrentInstance();
		String selectedPageViewId =
		context.getExternalContext().getRequestParameterMap().get("pageViewId");

		if (selectedPageViewId.equalsIgnoreCase("page1")){
			includedPage = "/layout1x2.xhtml";
		}
		else if (selectedPageViewId.equalsIgnoreCase("page2")){
			includedPage = "/samplePageTwo.xhtml";
		}
		else if (selectedPageViewId.equalsIgnoreCase("page3")){
			includedPage = "/samplePageThree.xhtml";
		}
		else if (selectedPageViewId.equalsIgnoreCase("page4")){
			includedPage = "/samplePageFour.xhtml";
		}
			return "";
	}

	/**
	 * @return the includedPage
	 */
	public String getIncludedPage()	{
		return includedPage;
	}

	/**
	 * @param includedPage the includedPage to set
	 */
	public void setIncludedPage(String includedPage){
		this.includedPage = includedPage;
	}
}
